import Index from "@/views/";

// 订单列表页
const orderList = () => import("@/views/orderList/orderList");
// 商品详情页
const Details = () => import("@/views/details/details");
// 订单详情页
const OrderDetails = () => import("@/views/orderDetails/orderDetails");
// 我的订单
const MakeSureOrder = () => import("@/views/makeSureOrder/makeSureOrder");
const AddressView = () => import("@/views/address");
// 收货地址
const Address = () => import("@/views/address/address");
// 新增收货地址
const JoinAddress = () => import("@/views/address/joinAddress");
// 规则协议
const RulesInfo = () => import("@/views/rulesInfo/");
// 支付成功
const Payment = () => import("@/views/payment/");
// 支付尾款
const tailMoney = () => import("@/views/tailMoney/");
// 支付尾款
const aMan = () => import("@/views/aMan/");
// 登陆
const logIn = () => import("@/views/logIn/");
/**
 * 默认路由配置
 */
const defaultRouters = [
  /* eslint-disable */
  {
    path: "/",
    component: Index,
    children: [
      {
        path: "",
        redirect: "/home"
      },
      {
        path: "/home",
        name: "Home",
        component: resolve => {
          require(["@/views/home/"], resolve);
        },
        meta: {
          title: "首页",
          home: true,
          // 是否被缓存
          keepAlive: true
        },
        icon: "item-home"
      },
      {
        path: "/my/orderList",
        name: "orderList",
        component: orderList,
        meta: {
          title: "我的订单",
          // 不显示返回按钮
          hasShowBack: false,
          // 是否被缓存
          keepAlive: true
        },
        icon: "item-orderList"
      }
    ]
  }
];
export const other = [
  {
    // 商品详情页
    path: "/goods/details/:id",
    name: "GoodsDetails",
    component: Details,
    meta: {
      title: "商品详情"
    },
    noShowMenu: true
  },
  {
    // 订单详情页
    path: "/goods/orderDetails/:id",
    component: OrderDetails,
    noShowMenu: true,
    meta: {
      title: "订单详情"
    }
  },
  {
    // 确认订单页
    path: "/goods/MakeSureOrder",
    name: "MakeSureOrder",
    component: MakeSureOrder,
    noShowMenu: true,
    meta: {
      title: "确认订单"
    }
  },
  // 地址管理
  {
    path: "/address",
    component: AddressView,

    // 不显示在主菜单上
    noShowMenu: true,
    children: [
      {
        path: "/address",
        redirect: "addressList/123"
      },
      {
        path: "addressList/:id",
        component: Address,
        name: "AddressList",
        meta: {
          // navigation上显示Btn（暂时之后新增收货地址按钮）以后扩展为自定义
          push: true,
          title: "选择收货地址"
        }
      },
      {
        path: "joinAddress",
        name: "JoinAddress",
        component: JoinAddress,
        meta: {
          title: "添加地址"
        }
      }
    ]
  },
  {
    path: "/service/greement",
    name: "ServiceAgreement",
    component: RulesInfo,
    noShowMenu: true,
    meta: {
      title: "疯狂折扣活动介绍",
      keepAlive: true // true 表示需要使用缓存 false表示不需要被缓存
    }
  },
  {
    path: "/Payment",
    name: "Payment",
    component: Payment,
    noShowMenu: true,
    meta: {
      title: "支付成功"
    }
  },
  // 支付尾款
  {
    path: "/tailMoney",
    name: "tailMoney",
    component: tailMoney,
    noShowMenu: true,
    meta: {
      title: "支付尾款"
    }
  },
  // 支付尾款
  {
    path: "/aMan",
    name: "aMan",
    component: aMan,
    noShowMenu: true,
    meta: {
      title: "折扣达人",
      // 不显示返回按钮
      hasShowBack: false,
      // 是否被缓存
      keepAlive: true
    }
  },
  // 支付尾款
  {
    path: "/login",
    name: "login",
    component: logIn,
    noShowMenu: true,
    meta: {
      title: "登录"
    }
  }
];

export default defaultRouters;
